#ifndef DEMUXTHREAD_H
#define DEMUXTHREAD_H

#include <QThread>
#include "demux.h"
#include <mutex>
#include "videothread.h"
#include "audiothread.h"

class DemuxThread : public QThread
{
    Q_OBJECT

public:

    explicit DemuxThread(QObject *parent = nullptr);
    ~DemuxThread();
public:

    bool open(const char* url);
    void start_all_thread();

protected:

    void run() override;

private:

    std::mutex mutex;
    Demux* demux;
    bool exit_flag = false;
    VideoThread* videoThread;
    AudioThread* audioThread;

};

#endif // DEMUXTHREAD_H
